package com.mall.common;

public enum ResultCode implements IResultCode {
    SUCCESS(200, "操作成功"),
    ERROR(500, "操作失败"),
    VALIDATE_FAILED(404, "参数检验失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(403, "没有相关权限"),
    
    // 用户相关错误码
    USER_NOT_EXIST(1001, "用户不存在"),
    USER_PASSWORD_ERROR(1002, "密码错误"),
    USER_ACCOUNT_EXPIRED(1003, "账号已过期"),
    USER_ACCOUNT_LOCKED(1004, "账号已被锁定"),
    USER_ACCOUNT_DISABLED(1005, "账号已被禁用"),
    USER_EXISTED(1006, "用户已存在"),
    
    // 商品相关错误码
    PRODUCT_NOT_EXIST(2001, "商品不存在"),
    PRODUCT_STOCK_INSUFFICIENT(2002, "商品库存不足"),
    PRODUCT_STATUS_ERROR(2003, "商品状态异常"),
    
    // 订单相关错误码
    ORDER_NOT_EXIST(3001, "订单不存在"),
    ORDER_STATUS_ERROR(3002, "订单状态异常"),
    ORDER_AMOUNT_ERROR(3003, "订单金额异常"),
    
    // 购物车相关错误码
    CART_NOT_EXIST(4001, "购物车不存在"),
    CART_ITEM_NOT_EXIST(4002, "购物车商品不存在"),
    CART_ITEM_QUANTITY_ERROR(4003, "购物车商品数量异常");

    private final Integer code;
    private final String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
} 